Skip to content

fix(claude): reconcile compacted tool results - #2663

Open
ryanngit wants to merge 1 commit into
decolua:masterfrom
ryanngit:claude-tool-result-pairing
Open

fix(claude): reconcile compacted tool results#2663
ryanngit wants to merge 1 commit into
decolua:masterfrom
ryanngit:claude-tool-result-pairing

Conversation

@ryanngit

@ryanngit ryanngit commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Fixes Anthropic /v1/messages 400 responses when compacted or cross-model history retains a tool result whose matching tool use is missing or no longer immediately previous.

  • Keeps valid structured tool results in tool-use order
  • Fills missing parallel results with existing empty-result fallback
  • Preserves orphaned and duplicate text output as labeled user text
  • Avoids serializing image or binary payloads from orphaned results
  • Handles single-message orphan history and intervening turns

Tested on pristine v0.5.45 base:

  • ./node_modules/.bin/vitest run --config tests/vitest.config.js --testTimeout 20000 tests/unit/claude-tool-result-pairing.test.js tests/unit/github-responses-routing.test.js tests/unit/openai-to-claude-tools-no-type.test.js tests/translator/format-roundtrip.test.js (22/22)
  • Focused ESLint
  • git diff --check
  • Gitleaks on v0.5.45..HEAD

@ryanngit
ryanngit force-pushed the claude-tool-result-pairing branch from ee0ce30 to 9504daa Compare July 19, 2026 10:09
@ryanngit

ryanngit commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

v0.5.45 refresh

  • Base: upstream/master = v0.5.45 (6fcd2733)
  • Branch head: 748e15efe1ef193271ac6b3e676f80587033c504
  • Merge state: CLEAN
  • Focused matrix: 4 files, 22/22 tests passed
  • Focused ESLint: passed
  • git diff --check: clean
  • Gitleaks on v0.5.45..HEAD: no leaks

Added regression coverage for duplicate results, image-only orphan handling, paired image preservation, and results after intervening turns.

ryuusuke17 pushed a commit to ryuusuke17/9router that referenced this pull request Jul 29, 2026
Mirror OmniRoute PR decolua#2663 behavior:
- Add COMBO_TARGET_TIMEOUT_MS env (default 120s) to runtimeConfig.
- Race each combo target against a timeout; on timeout abort the target
  and return a synthetic 524 so fallback continues.
- Propagate the client request signal into combo targets and stop the
  combo loop immediately on client disconnect (499).
- Merge external combo signal with request.signal inside handleSingleModelChat
  so upstream fetches are aborted on either timeout or disconnect.

Unit tests cover hanging target fallback, signal propagation, and
client-abort short-circuit.
@ryanngit
ryanngit force-pushed the claude-tool-result-pairing branch from 406939a to 748e15e Compare August 3, 2026 06:25
golamrabbi696 added a commit to golamrabbi696/EzRouter that referenced this pull request Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant